package Test1.PTZ;

import Test1.HCNetSDK;
import com.sun.jna.NativeLong;
import com.sun.jna.ptr.IntByReference;

/**
 * Created by panting6 on 2021/6/25.
 */
public class GetPreSetName {
    static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
    public void getPreSetName(int lUserID, NativeLong iChannelNum,short presetNum) {
        HCNetSDK.NET_DVR_PRESET_NAME preset_name = new HCNetSDK.NET_DVR_PRESET_NAME();
        preset_name.dwSize = preset_name.size();
        preset_name.wPresetNum = presetNum;

        preset_name.write();
        IntByReference lpBytesReturned = new IntByReference(0);
        if (!hCNetSDK.NET_DVR_GetDVRConfig(lUserID, HCNetSDK.NET_DVR_GET_PRESET_NAME,iChannelNum, preset_name.getPointer(), preset_name.size(), lpBytesReturned))
        {
            System.out.println("获得预置点失败，错误号：" + hCNetSDK.NET_DVR_GetLastError());

        }else {
            preset_name.read();

            String name = new String(preset_name.byName);

            System.out.println("获得预置点成功,预置点"+ name + "的P值：" + preset_name.wPanPos + ",T值：" + preset_name.wTiltPos + ",Z值：" + preset_name.wZoomPos);

        }
    }
}
